<template>
	<view class="container">
		<Header>大会发言</Header>
		<view class="content">
			<view class="title">
				{{data.title}}
			</view>
			<view class="date">
				<span>{{data.createtime}}</span>
			</view>
			<view v-html="data.content"></view>
			<view class="status">
				【{{ data.status_text }}】
			</view>
			<!-- <view class="bottom">
				<view class="item" :class="{active: data.like==1}" @click="dlikecCollect(1)">
					<uni-icons type="hand-up-filled" size="30"></uni-icons>
				</view>
				<view class="item" :class="{active: data.collect==1}" @click="dlikecCollect(2)">
					<uni-icons type="star-filled" size="30"></uni-icons>
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import Header from '../../components/header.vue'
	import request from '../../common/request.js'
	export default {
		components: {
			Header
		},
		data() {
			return {
				id: '',
				data:{}
			}
		},
		onLoad(option) {
			this.id  = option.id
		},
		mounted(){
			this.getDetailData()
		},
		methods: {
			getDetailData(){
				request({
					url:'/speak/detail',
					data:{
						speak_id: this.id
					},
					method: 'POST'
				}).then(res => {
					if(res.code == 1){
						this.data = res.data
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
					}
				})
			},
			dlikecCollect(type){
				request({
					url:'/speak/dlikecCollect',
					data:{
						speak_id: this.id,
						type: type
					},
					method: 'POST'
				}).then(res => {
					if(res.code == 1){
						let msg = ''
						if(type == 1){
							if(this.data.like == 1){
								this.data.like = 0
								msg = '取消点赞'
							}else{
								this.data.like = 1
								msg = '点赞成功'
							}
						}else{
							if(this.data.collect == 1){
								this.data.collect = 0
								msg = '取消收藏'
							}else{
								this.data.collect = 1
								msg = '收藏成功'
							}
						}
						uni.showToast({
							title: msg,
							icon: 'none',
							duration: 2000
						});
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		/* background-color: #f9f9f9;
		min-height: calc(100vh - 45px); */
	}

	.content {
		padding: 20px;
		line-height: 30px;
	}

	.title {
		font-size: 16px;
		font-weight: bold;
		text-align: center;
		line-height: 26px;
	}

	.date {
		font-size: 14px;
		text-align: center;
		margin: 15px 0px;
	}
	.bottom{
		/* position: sticky;
		bottom: 10px; */
		margin: 10px 0px;
		display: flex;
		align-items: center;
		justify-content: center;
		.item{
			border: 1px solid #e2e2e2;
			display: inline-block;
			width: 50px;
			height: 50px;
			border-radius: 50%;
			display: flex;
			align-items: center;
			justify-content: center;
			margin: 0px 15px;
			&.active {
				::v-deep .uni-icons {
					color: #ea5b6a !important;
				}
			}
		}
	}
	.status{
		color: #fb7a30;
	}
</style>